#define MAX_NUMBER_OF_CHILDREN	26
int char_to_int(char);
int* string_to_int (char*);
int nombre_caracteres_valides(char*);
char int_to_char(int, int);
char* int_to_string(int*,int,int);
char* cesar (char*, int);
char* vigenere(char*, char*);
char* d_cesar (char*, int);
char* d_vigenere(char*, char*);
int decalage_d(int, int);
int decalage(int, int);
char* extract(char*);
void affichage (char*);
void traitement_cesar(int, char**, int, int, int*, char**, int**);
void traitement_vigenere(int,char**,int,int,int*,char**,char**,int**);
void traitement_freqC(char**,char**,int**);
char* oter_espaces(char*);
void usage_cesar();
void usage_vigenere();
void usage_dcesar();
void usage_dvigenere();
void usage_machine();
void usage_freqC();




/*
	Partie liée à l'attaque par fréquence
*/
/*Partie Arbre*/
typedef struct Tree Tree;
struct Tree{
	int* id;
	int* path;
	int nb_children;
	int nb_children_max;
	struct Tree* parent;
	struct Tree** children;
	};
void copy_id(Tree, Tree*);
void update_id(Tree*, int, int);
int number_next_child(Tree);
void copy_path(Tree, Tree*);
void update_path(Tree, Tree* B);
void update_children(Tree*, Tree*);
Tree* go_to_child(Tree, int);
Tree* go_to_parent(Tree*);
Tree* go_to_root(Tree*);
Tree* add_child(Tree*, int, int);
Tree* create();
void print_path(Tree);
void print_id(Tree);
int is_root(Tree);
void remove_tree(Tree*);
void print_tree(Tree, int*, int, FILE*);
int* identify(Tree*, int);
int exist_in_children(Tree, int, int);
void next_bigrams(Tree*,int, int*);

/*Partie fréquence*/

void frequencies(int*, int, float*, float*);
float th_frequency(int);
float th_frequency_b(int);
int is_identified(int, int*);
int next_proposition(float*, int*);
int exist_match(int*, int*);
int match_bigram(int*, int*, float*);




















/*partie machine */


typedef struct Rotor Rotor;
struct Rotor{

	int* sorties; /* tableau de 26 entrées, la première valeur correspond à la sortie de la lettre a etc...*/
	int encoche; /* quelle est la position du rotor qui entraine la rotation du suivant */
};


typedef struct Reflecteur Reflecteur;
struct Reflecteur{

	int* sorties;
};


typedef struct Plugboard Plugboard;
struct Plugboard{

	int** connexions; /* il y a dix fils, donc dix paires de lettres, tableau? structure spécifique?*/
};








int traitement(Rotor*,Rotor*,Rotor*,Reflecteur*,Plugboard*,int*,int*,int*,int,int);
void mouvement_rotors(Rotor*,Rotor*,Rotor*,int*,int*,int*);
void affichage_machine(int,int,int,int,int);
int traitement_machine(int,char**,int*,char**,Plugboard*);
int appartient_permutation(int,int**,int);
void decaler_rotor(Rotor*);
